package org.beetl.sql.core.engine;

import org.beetl.core.Context;
import org.beetl.core.Function;
import org.beetl.sql.core.kit.StringKit;

/**
 * 判断字符串是否非空
 * @author Succy
 * create on 2019/2/3
 */
public class NotBlankExpressionFunction implements Function {
    @Override
    public Object call(Object[] paras, Context ctx) {
        Object param = paras[0];
        if (param != null) {
            if (!String.class.isInstance(param)) {
                throw new IllegalArgumentException("期望参数是String类型");
            }
            return StringKit.isNotBlank((String) param);
        }
        return false;
    }
}
